package com.zwf.domain.strategy.repository;

import com.zwf.domain.strategy.model.entity.StrategyAwardEntity;
import com.zwf.domain.strategy.model.entity.StrategyEntity;
import com.zwf.domain.strategy.model.entity.StrategyRuleEntry;

import java.util.HashMap;
import java.util.List;

/**
 * @Author zwf
 * @description 策略仓储接口
 * @date 2024/7/1 12:06
 */
public interface IStrategyRepository {

    /**
     * 查询策略配置
     * @param strategyId
     */
    List<StrategyAwardEntity> queryStrategyAwardList(Long strategyId);

    /**
     * 存储到Redis
     * @param key
     * @param rateRange
     * @param shuffleStrategyAwardSearchRateTables
     */
    void storeStrategyAwardSearchRateTablesToRedis(String key, Integer rateRange, HashMap<Integer, Integer> shuffleStrategyAwardSearchRateTables);

    /**
     * 获取概率范围
     * @param strategyId
     * @return
     */
    Integer getRateRange(Long strategyId);

    /**
     * 获取概率范围
     * @param key
     * @return
     */
    Integer getRateRange(String key);

    /**
     * 抽奖
     * @param key
     * @param rateKey
     * @return
     */
    Integer getStrategyAwardAssemble(String key, int rateKey);

    /**
     * 查询策略
     * @param strategyId
     * @return
     */
    StrategyEntity queryStategyEntity(Long strategyId);

    /**
     * 查询规则
     *
     * @param strategyId
     * @param ruleruleModel
     * @return
     */
    StrategyRuleEntry queryStrategyRuleEntity(Long strategyId, String ruleruleModel);

    /**
     * 查询策略规则值
     * @param strategyId
     * @param awardId
     * @param ruleModel
     * @return
     */
    String queryStrategyRuleValue(Long strategyId, Integer awardId, String ruleModel);

    /**
     * 查询是否存在于黑名单列表
     * @param userId
     * @param strategyId
     * @return
     */
    Integer queryUserBlacklist(Long userId, Long strategyId);

    /**
     * 查询用户积分消耗积累
     * @param userId
     * @param strategyId
     * @return
     */
    Integer queryPointAccumulate(Long userId, Long strategyId);

    /**
     * 查询策略实体
     * @param strategyId
     * @return
     */
    StrategyEntity queryStrategyEntity(Long strategyId);
}
